package com.example.demo.service.impl;

import com.example.demo.dao.ConceptMapper;
import com.example.demo.modal.Concept;
import com.example.demo.service.ConceptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConceptServiceImpl implements ConceptService {
    @Autowired
    ConceptMapper conceptMapper;

    public List<Concept> findAll() {
        return conceptMapper.selectAll();
    }

    public Integer addConcept(Concept concept){return conceptMapper.insert(concept);}

    public Integer findMaxId(){return conceptMapper.selectMaxId();}

    public Integer updateConcept(Concept concept){
        return  conceptMapper.updateByPrimaryKey(concept);
    }

    public Integer deleteConcept(Integer id){
        return conceptMapper.deleteByPrimaryKey(id);
    }

    public List<Concept> findByConceptId(Integer id){ return conceptMapper.selectByPrimaryKey(id); }

    public List<Concept> findByVariaName(String name){return conceptMapper.selectByVariaName(name);}

    public List<Concept> findByParentId(Integer id){return conceptMapper.selectByParentId(id);}
}
